{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "364d5bc9",
   "metadata": {},
   "source": [
    "* 2023-11-20\n",
    "* 课程： Python语言\n",
    "* week12课堂"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "885f1697",
   "metadata": {},
   "source": [
    "# 字典的创建\n",
    "> 1.按照数据结构的形态创建，[,](,){,}   \n",
    "> 2.按照数据结构的方法创建：list(),tuple(),set(),dict()   \n",
    "> 3.根据自身的性质创建：   \n",
    ">> 1.[].append   \n",
    ">> 2.value1,value2,value3   "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 116,
   "id": "459e8ed8",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{'name': 'Amy', 'country': 'USA', 'telephone': 1178}\n",
      "<class 'dict'>\n"
     ]
    }
   ],
   "source": [
    "# 方法一：\n",
    "person = {\"name\":\"Amy\",\n",
    "         \"country\":\"USA\",\n",
    "         \"telephone\": 1178}\n",
    "print(person)\n",
    "print(type(person))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 117,
   "id": "b1e376cd",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{'name': 'Amy', 'country': 'USA', 'telephone': 1178}\n",
      "<class 'dict'>\n"
     ]
    }
   ],
   "source": [
    "# 方法二：\n",
    "person = dict(\n",
    "    name = \"Amy\",\n",
    "    country = \"USA\",\n",
    "    telephone = 1178\n",
    ")\n",
    "print(person)\n",
    "print(type(person))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 118,
   "id": "5e8e0425",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{'name': 'Amy', 'country': 'USA', 'telephone': 1178}\n",
      "<class 'dict'>\n"
     ]
    }
   ],
   "source": [
    "# 方法三：字典元素的新增\n",
    "person = {}\n",
    "person[\"name\"] = \"Amy\"\n",
    "person[\"country\"] = \"USA\"\n",
    "person[\"telephone\"] = 1178\n",
    "print(person)\n",
    "print(type(person))"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "092c1c39",
   "metadata": {},
   "source": [
    "# 字典的一般方法\n",
    "## 1.查询\n",
    "> in方法：查询dict中是否存在其关键词key"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 119,
   "id": "a5d1bfe5",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 119,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "\"name\" in person"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 120,
   "id": "7098a44e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "False"
      ]
     },
     "execution_count": 120,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "\"Amy\" in person"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 121,
   "id": "67e2f924",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'Amy'"
      ]
     },
     "execution_count": 121,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "person.get(\"name\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 122,
   "id": "479ef823",
   "metadata": {},
   "outputs": [],
   "source": [
    "person.get(\"Amy\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 123,
   "id": "9f8ade63",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Amy\n"
     ]
    }
   ],
   "source": [
    "keys = \"name\"\n",
    "if \"name\" in person:\n",
    "    print(person.get(keys))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 124,
   "id": "41650cd4",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Help on built-in function get:\n",
      "\n",
      "get(key, default=None, /) method of builtins.dict instance\n",
      "    Return the value for key if key is in the dictionary, else default.\n",
      "\n"
     ]
    }
   ],
   "source": [
    "help(person.get)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "6bd968a0",
   "metadata": {},
   "source": [
    "## 2.字典的item方法(关于字典的循环）"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 125,
   "id": "2d2aa80c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "dict_items([('name', 'Amy'), ('country', 'USA'), ('telephone', 1178)])"
      ]
     },
     "execution_count": 125,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "person.items()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 126,
   "id": "2dd33a62",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "name\n",
      "country\n",
      "telephone\n"
     ]
    }
   ],
   "source": [
    "# 循环一个元素得到的结果是key\n",
    "for i in person:\n",
    "    print(i)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 127,
   "id": "2317f929",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "name Amy\n",
      "country USA\n",
      "telephone 1178\n"
     ]
    }
   ],
   "source": [
    "for k,v in person.items():\n",
    "    print(k,v)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 128,
   "id": "fd1d7b27",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{'小明': 80, '小红': 85, 'Amy': 95}\n"
     ]
    }
   ],
   "source": [
    "# 案例： 需求，找出所有的大于90分的同学\n",
    "python_成绩 = {\n",
    "    \"小明\":80,\n",
    "    \"小红\":85,\n",
    "    \"Amy\":95\n",
    "}\n",
    "print(python_成绩)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 129,
   "id": "a08c1e35",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Amy 95\n"
     ]
    }
   ],
   "source": [
    "for k,v in python_成绩.items():\n",
    "    if v > 90:\n",
    "        print(k,v)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "b49bc5be",
   "metadata": {},
   "source": [
    "# 3.字典的keys，values方法\n",
    "> 1.keys:可以查看所有关键词，大致了解下有哪些属性\n",
    "> 2.values:可以查看所有的结果，大致了解下结果的特征"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 130,
   "id": "a8c2dc85",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "dict_keys(['name', 'country', 'telephone'])"
      ]
     },
     "execution_count": 130,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    " person.keys()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 131,
   "id": "8d65988d",
   "metadata": {},
   "outputs": [],
   "source": [
    "import requests"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 132,
   "id": "017b4097",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'args': {},\n",
       " 'headers': {'Accept': '*/*',\n",
       "  'Accept-Encoding': 'gzip, deflate, br',\n",
       "  'Host': 'httpbin.org',\n",
       "  'User-Agent': 'python-requests/2.29.0',\n",
       "  'X-Amzn-Trace-Id': 'Root=1-65647ae0-7b38e02a20a37f096f40c1af'},\n",
       " 'origin': '223.104.76.197',\n",
       " 'url': 'https://httpbin.org/get'}"
      ]
     },
     "execution_count": 132,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "r = requests.get(\"https://httpbin.org/get\")\n",
    "results = r.json()\n",
    "results"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 133,
   "id": "32740f62",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "dict_keys(['args', 'headers', 'origin', 'url'])"
      ]
     },
     "execution_count": 133,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "results.keys()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 134,
   "id": "32d77cec",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "dict_keys(['args', 'headers', 'origin', 'url'])"
      ]
     },
     "execution_count": 134,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "results.keys()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 135,
   "id": "bb3bc9bc",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "dict_keys(['Accept', 'Accept-Encoding', 'Host', 'User-Agent', 'X-Amzn-Trace-Id'])"
      ]
     },
     "execution_count": 135,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "results[\"headers\"].keys()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 136,
   "id": "56664f12",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "dict_values(['Amy', 'USA', 1178])"
      ]
     },
     "execution_count": 136,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "person.values()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "957ddccf",
   "metadata": {},
   "source": [
    "# 4.字典的删除：pop"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 137,
   "id": "d553e9e0",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'name': 'Amy', 'country': 'USA', 'telephone': 1178}"
      ]
     },
     "execution_count": 137,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 一般情况下，所有的数据做删除操作时，都会有备份的操作\n",
    "person_备份 = person.copy()\n",
    "person_备份"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 138,
   "id": "60b9ee17",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'country': 'USA', 'telephone': 1178}"
      ]
     },
     "execution_count": 138,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "if \"name\" in person:\n",
    "    person.pop(\"name\")\n",
    "person"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 139,
   "id": "ac857bf6",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'country': 'USA', 'telephone': 1178}"
      ]
     },
     "execution_count": 139,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "person"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 140,
   "id": "6d9abe5e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "('telephone', 1178)"
      ]
     },
     "execution_count": 140,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "person.popitem()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 141,
   "id": "02d17c6c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'country': 'USA'}"
      ]
     },
     "execution_count": 141,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "person"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "035c070f",
   "metadata": {},
   "source": [
    "## 5.关于字典的特殊（高级）用法\n",
    "> 1.fromkeys()   \n",
    "> 2.setdefault()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 142,
   "id": "a594cc69",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{'name': 'Amy', 'country': 'USA', 'telephone': 1178}\n",
      "<class 'dict'>\n"
     ]
    }
   ],
   "source": [
    "person = {}\n",
    "person[\"name\"] = \"Amy\"\n",
    "person[\"country\"] = \"USA\"\n",
    "person[\"telephone\"] = 1178\n",
    "print(person)\n",
    "print(type(person))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 143,
   "id": "128f906b",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Help on built-in function fromkeys:\n",
      "\n",
      "fromkeys(iterable, value=None, /) method of builtins.type instance\n",
      "    Create a new dictionary with keys from iterable and values set to value.\n",
      "\n"
     ]
    }
   ],
   "source": [
    "help(person.fromkeys)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 144,
   "id": "40a549cb",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 我们可以创建一个字典，字典的value可以自定义（初始化）\n",
    "\n",
    "name_list = [\"Mary\",\"jack\",\"年少的我\",\"00后的时代\"]\n",
    "my_world = {}\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 145,
   "id": "a5405f59",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'Mary': 10, 'jack': 10, '年少的我': 10, '00后的时代': 10}"
      ]
     },
     "execution_count": 145,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "my_world.fromkeys(name_list,10)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "fe8e39d5",
   "metadata": {},
   "source": [
    "## 4.2 setdefault()\n",
    "> 1.指定key为某个值，但如果该key已经存在，就不执行\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 146,
   "id": "0cb70653",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'活泼开朗，非常有主见'"
      ]
     },
     "execution_count": 146,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "tinydict = {\n",
    "    \"Mary\":\"活泼开朗，非常有主见\",\n",
    "    \"Jack\":\"内向，独立\"\n",
    "}\n",
    "tinydict.setdefault(\"Mary\",\"心胸狭窄，斤斤计较\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 147,
   "id": "a368d78f",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'Mary': '活泼开朗，非常有主见', 'Jack': '内向，独立'}"
      ]
     },
     "execution_count": 147,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "tinydict"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 148,
   "id": "c6957b14",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'心胸狭窄，斤斤计较'"
      ]
     },
     "execution_count": 148,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "tinydict.setdefault(\"john\",\"心胸狭窄，斤斤计较\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 149,
   "id": "505e7933",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'Mary': '活泼开朗，非常有主见', 'Jack': '内向，独立', 'john': '心胸狭窄，斤斤计较'}"
      ]
     },
     "execution_count": 149,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "tinydict"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 150,
   "id": "14a81f16",
   "metadata": {},
   "outputs": [],
   "source": [
    "tinydict[\"John\"] = \"心胸狭窄，斤斤计较\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 151,
   "id": "784aef91",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'Mary': '活泼开朗，非常有主见',\n",
       " 'Jack': '内向，独立',\n",
       " 'john': '心胸狭窄，斤斤计较',\n",
       " 'John': '心胸狭窄，斤斤计较'}"
      ]
     },
     "execution_count": 151,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "tinydict"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "94d17016",
   "metadata": {},
   "source": [
    "# 5.实践\n",
    "> 1.keys有哪些\n",
    "> 2.roads有哪些\n",
    "> 3.name有哪些\n",
    "> 4.direction为北的name有哪些\n",
    "> 5.有tel的建筑（name） 有哪些\n",
    "> 6.type为“餐饮服务”的有哪些\n",
    "> 7.distance 小于200米的建筑设施有哪些\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 152,
   "id": "6dddf705",
   "metadata": {},
   "outputs": [],
   "source": [
    "geo_nfu = {'status': '1',\n",
    " 'regeocode': {'roads': [{'id': '020F49F0050461206',\n",
    "    'location': '113.678,23.6284',\n",
    "    'direction': '北',\n",
    "    'name': '博学路',\n",
    "    'distance': '7.63232'},\n",
    "   {'id': '020F49F0050462229',\n",
    "    'location': '113.679,23.6245',\n",
    "    'direction': '北',\n",
    "    'name': '老虎形街',\n",
    "    'distance': '445.159'},\n",
    "   {'id': '020F49F005046601453',\n",
    "    'location': '113.677,23.6347',\n",
    "    'direction': '南',\n",
    "    'name': '中山路',\n",
    "    'distance': '712.706'}],\n",
    "  'roadinters': [{'second_name': '中山路',\n",
    "    'first_id': '020F49F0050461206',\n",
    "    'second_id': '020F49F005046601453',\n",
    "    'location': '113.676745,23.634493',\n",
    "    'distance': '691.177',\n",
    "    'first_name': '博学路',\n",
    "    'direction': '南'}],\n",
    "  'formatted_address': '广东省广州市从化区温泉镇博学路广州南方学院',\n",
    "  'addressComponent': {'city': '广州市',\n",
    "   'province': '广东省',\n",
    "   'adcode': '440117',\n",
    "   'district': '从化区',\n",
    "   'towncode': '440117100000',\n",
    "   'streetNumber': {'number': '24号',\n",
    "    'location': '113.677267,23.629149',\n",
    "    'direction': '西北',\n",
    "    'distance': '129.943',\n",
    "    'street': '博学路'},\n",
    "   'country': '中国',\n",
    "   'township': '温泉镇',\n",
    "   'businessAreas': [[]],\n",
    "   'building': {'name': [], 'type': []},\n",
    "   'neighborhood': {'name': [], 'type': []},\n",
    "   'citycode': '020'},\n",
    "  'aois': [{'area': '530435.909488',\n",
    "    'type': '141201',\n",
    "    'id': 'B00140MR9A',\n",
    "    'location': '113.679240,23.632576',\n",
    "    'adcode': '440117',\n",
    "    'name': '广州南方学院',\n",
    "    'distance': '0'}],\n",
    "  'pois': [{'id': 'B00140MR9A',\n",
    "    'direction': '北',\n",
    "    'businessarea': [],\n",
    "    'address': '温泉大道882号',\n",
    "    'poiweight': '0.450402',\n",
    "    'name': '广州南方学院',\n",
    "    'location': '113.679240,23.632576',\n",
    "    'distance': '470.34',\n",
    "    'tel': [],\n",
    "    'type': '科教文化服务;学校;高等院校'},\n",
    "   {'id': 'B0FFK8J7XY',\n",
    "    'direction': '东',\n",
    "    'businessarea': [],\n",
    "    'address': '温泉大道882号广州南方学院',\n",
    "    'poiweight': '0.233244',\n",
    "    'name': '广州南方学院(东南门)',\n",
    "    'location': '113.678689,23.628304',\n",
    "    'distance': '44.279',\n",
    "    'tel': [],\n",
    "    'type': '通行设施;临街院门;临街院门'},\n",
    "   {'id': 'B0FFHRJDM9',\n",
    "    'direction': '东南',\n",
    "    'businessarea': [],\n",
    "    'address': '中大南方学院南门1号',\n",
    "    'poiweight': '0.256152',\n",
    "    'name': '中南公寓',\n",
    "    'location': '113.680340,23.627566',\n",
    "    'distance': '231.223',\n",
    "    'tel': '13711245345',\n",
    "    'type': '商务住宅;住宅区;住宅小区'},\n",
    "   {'id': 'B0H0M9NO43',\n",
    "    'direction': '东北',\n",
    "    'businessarea': [],\n",
    "    'address': '博学路广州南方学院',\n",
    "    'poiweight': '0.292147',\n",
    "    'name': '广州南方学院南方湖观景台',\n",
    "    'location': '113.679464,23.630429',\n",
    "    'distance': '252.022',\n",
    "    'tel': [],\n",
    "    'type': '风景名胜;风景名胜;观景点'},\n",
    "   {'id': 'B0FFHC4XU0',\n",
    "    'direction': '东北',\n",
    "    'businessarea': [],\n",
    "    'address': '温泉大道886号',\n",
    "    'poiweight': '0.191595',\n",
    "    'name': '广州南方学院学术交流中心',\n",
    "    'location': '113.680066,23.630242',\n",
    "    'distance': '270.76',\n",
    "    'tel': [],\n",
    "    'type': '科教文化服务;会展中心;会展中心'},\n",
    "   {'id': 'B0FFKP838K',\n",
    "    'direction': '北',\n",
    "    'businessarea': [],\n",
    "    'address': '博学路25号',\n",
    "    'poiweight': '0.191742',\n",
    "    'name': '教学楼3号(外国语学院)',\n",
    "    'location': '113.677247,23.630947',\n",
    "    'distance': '298.093',\n",
    "    'tel': [],\n",
    "    'type': '科教文化服务;学校;高等院校'},\n",
    "   {'id': 'B0FFG4TAF2',\n",
    "    'direction': '东南',\n",
    "    'businessarea': [],\n",
    "    'address': '温泉镇乌土村松浪队5号(近博学路)',\n",
    "    'poiweight': '0.237309',\n",
    "    'name': '广州南方公寓',\n",
    "    'location': '113.678983,23.627778',\n",
    "    'distance': '102.617',\n",
    "    'tel': '13622768437',\n",
    "    'type': '住宿服务;旅馆招待所;旅馆招待所'},\n",
    "   {'id': 'B0FFKP7GY5',\n",
    "    'direction': '北',\n",
    "    'businessarea': [],\n",
    "    'address': '温泉大道882号',\n",
    "    'poiweight': '0.218221',\n",
    "    'name': '广州南方学院3号实验楼',\n",
    "    'location': '113.678650,23.630612',\n",
    "    'distance': '244.566',\n",
    "    'tel': [],\n",
    "    'type': '地名地址信息;门牌信息;楼栋号'},\n",
    "   {'id': 'B0GKYRKNUA',\n",
    "    'direction': '东南',\n",
    "    'businessarea': [],\n",
    "    'address': '温泉镇平岗村乌土平岗街25号(中南公寓旁)',\n",
    "    'poiweight': '0.209893',\n",
    "    'name': '乐妍茶(中大店)',\n",
    "    'location': '113.680097,23.627643',\n",
    "    'distance': '205.173',\n",
    "    'tel': '18028862548',\n",
    "    'type': '餐饮服务;冷饮店;冷饮店'},\n",
    "   {'id': 'B0H33OZ7BU',\n",
    "    'direction': '北',\n",
    "    'businessarea': [],\n",
    "    'address': '博学路广州南方学院',\n",
    "    'poiweight': '0.191148',\n",
    "    'name': '广州南方学院学术报告厅',\n",
    "    'location': '113.678698,23.631219',\n",
    "    'distance': '312.056',\n",
    "    'tel': [],\n",
    "    'type': '科教文化服务;科教文化场所;科教文化场所'},\n",
    "   {'id': 'B0JRKNVEFY',\n",
    "    'direction': '东北',\n",
    "    'businessarea': [],\n",
    "    'address': '温泉镇笃行路20、22、24号广州南方学院商业中心1层1F-001-1号',\n",
    "    'poiweight': '0.209894',\n",
    "    'name': '喜茶(广州南方学院店)',\n",
    "    'location': '113.679905,23.630533',\n",
    "    'distance': '285.72',\n",
    "    'tel': [],\n",
    "    'type': '餐饮服务;冷饮店;冷饮店'},\n",
    "   {'id': 'B0HGD588HJ',\n",
    "    'direction': '北',\n",
    "    'businessarea': [],\n",
    "    'address': '温泉大道882号',\n",
    "    'poiweight': '0.221662',\n",
    "    'name': '广州南方学院4号教学楼',\n",
    "    'location': '113.677461,23.630578',\n",
    "    'distance': '252.08',\n",
    "    'tel': [],\n",
    "    'type': '地名地址信息;门牌信息;楼栋号'},\n",
    "   {'id': 'B0H1XKYTYG',\n",
    "    'direction': '西北',\n",
    "    'businessarea': [],\n",
    "    'address': '温泉大道882号广州南方学院',\n",
    "    'poiweight': '0.198742',\n",
    "    'name': '广州南方学院西区篮球场',\n",
    "    'location': '113.677741,23.629552',\n",
    "    'distance': '135.401',\n",
    "    'tel': [],\n",
    "    'type': '体育休闲服务;运动场馆;篮球场馆'},\n",
    "   {'id': 'B0HGDU76L2',\n",
    "    'direction': '北',\n",
    "    'businessarea': [],\n",
    "    'address': '温泉大道882号',\n",
    "    'poiweight': '0.221662',\n",
    "    'name': '广州南方学院2号实验楼',\n",
    "    'location': '113.678327,23.630969',\n",
    "    'distance': '281.377',\n",
    "    'tel': [],\n",
    "    'type': '地名地址信息;门牌信息;楼栋号'},\n",
    "   {'id': 'B0IB2GMPW4',\n",
    "    'direction': '东北',\n",
    "    'businessarea': [],\n",
    "    'address': '温泉镇笃行路20、22、24号中山大学南方学院商业中心一楼1F-005',\n",
    "    'poiweight': '0.218331',\n",
    "    'name': '古茗(南方学院店)',\n",
    "    'location': '113.680105,23.630681',\n",
    "    'distance': '311.024',\n",
    "    'tel': '13717659301;18027267535',\n",
    "    'type': '餐饮服务;休闲餐饮场所;休闲餐饮场所'},\n",
    "   {'id': 'B0I12780ZU',\n",
    "    'direction': '东南',\n",
    "    'businessarea': [],\n",
    "    'address': '内部地面停车场',\n",
    "    'poiweight': '0.203102',\n",
    "    'name': '内部地面停车场(出入口)',\n",
    "    'location': '113.679445,23.627444',\n",
    "    'distance': '162.262',\n",
    "    'tel': [],\n",
    "    'type': '交通设施服务;停车场;停车场出入口'},\n",
    "   {'id': 'B0I1276BCM',\n",
    "    'direction': '东南',\n",
    "    'businessarea': [],\n",
    "    'address': [],\n",
    "    'poiweight': '0.257239',\n",
    "    'name': '内部地面停车场',\n",
    "    'location': '113.679445,23.627444',\n",
    "    'distance': '162.262',\n",
    "    'tel': [],\n",
    "    'type': '交通设施服务;停车场;专用停车场'},\n",
    "   {'id': 'B0H25SMRKP',\n",
    "    'direction': '东北',\n",
    "    'businessarea': [],\n",
    "    'address': '温泉大道882号广州南方学院',\n",
    "    'poiweight': '0.263595',\n",
    "    'name': '广州南方学院大礼堂',\n",
    "    'location': '113.680076,23.631502',\n",
    "    'distance': '386.65',\n",
    "    'tel': [],\n",
    "    'type': '科教文化服务;科教文化场所;科教文化场所'},\n",
    "   {'id': 'BV11417822',\n",
    "    'direction': '东南',\n",
    "    'businessarea': [],\n",
    "    'address': '从15路从20路',\n",
    "    'poiweight': '0.400088',\n",
    "    'name': '南方学院后门总站(公交站)',\n",
    "    'location': '113.679280,23.627201',\n",
    "    'distance': '171.243',\n",
    "    'tel': [],\n",
    "    'type': '交通设施服务;公交车站;公交车站相关'},\n",
    "   {'id': 'B0FFK0MZII',\n",
    "    'direction': '东',\n",
    "    'businessarea': [],\n",
    "    'address': '温泉大道882号广州南方学院后门润泰超市一楼',\n",
    "    'poiweight': '0.10175',\n",
    "    'name': '街电(尚千谷中大南方店)',\n",
    "    'location': '113.680254,23.627804',\n",
    "    'distance': '213.132',\n",
    "    'tel': [],\n",
    "    'type': '生活服务;共享设备;充电宝'},\n",
    "   {'id': 'B0HRV1D5FP',\n",
    "    'direction': '东北',\n",
    "    'businessarea': [],\n",
    "    'address': '温泉大道882号广州南方学院',\n",
    "    'poiweight': '0.191158',\n",
    "    'name': '广州南方学院博物馆',\n",
    "    'location': '113.679624,23.631631',\n",
    "    'distance': '380.463',\n",
    "    'tel': [],\n",
    "    'type': '科教文化服务;博物馆;博物馆'},\n",
    "   {'id': 'B0FFKMSV6B',\n",
    "    'direction': '西北',\n",
    "    'businessarea': [],\n",
    "    'address': '温泉大道882号',\n",
    "    'poiweight': '0.232574',\n",
    "    'name': '广州南方学院西学楼2号楼',\n",
    "    'location': '113.675891,23.630025',\n",
    "    'distance': '300.564',\n",
    "    'tel': [],\n",
    "    'type': '地名地址信息;门牌信息;楼栋号'},\n",
    "   {'id': 'B0FFKP81F0',\n",
    "    'direction': '西北',\n",
    "    'businessarea': [],\n",
    "    'address': '博学路与中山路交叉口南340米',\n",
    "    'poiweight': '0.191742',\n",
    "    'name': '教学楼1号(文学与传媒学院)',\n",
    "    'location': '113.676866,23.631736',\n",
    "    'distance': '393.93',\n",
    "    'tel': [],\n",
    "    'type': '科教文化服务;科教文化场所;科教文化场所'},\n",
    "   {'id': 'B0HGDU99RM',\n",
    "    'direction': '北',\n",
    "    'businessarea': [],\n",
    "    'address': '温泉大道882号广州南方学院内',\n",
    "    'poiweight': '0.257947',\n",
    "    'name': '广州南方学院图书馆',\n",
    "    'location': '113.679303,23.632322',\n",
    "    'distance': '444.196',\n",
    "    'tel': '020-61787368;020-61787371',\n",
    "    'type': '科教文化服务;图书馆;图书馆'},\n",
    "   {'id': 'B0HGDU92JD',\n",
    "    'direction': '北',\n",
    "    'businessarea': [],\n",
    "    'address': '温泉大道882号',\n",
    "    'poiweight': '0.221662',\n",
    "    'name': '广州南方学院1号教学楼',\n",
    "    'location': '113.676968,23.631720',\n",
    "    'distance': '388.57',\n",
    "    'tel': [],\n",
    "    'type': '地名地址信息;门牌信息;楼栋号'},\n",
    "   {'id': 'B0FFH6K3U9',\n",
    "    'direction': '西北',\n",
    "    'businessarea': [],\n",
    "    'address': '温泉镇温泉大道882号广州南方学院H7栋1-5层',\n",
    "    'poiweight': '0.254885',\n",
    "    'name': '广州中大南方招待所',\n",
    "    'location': '113.676330,23.631332',\n",
    "    'distance': '378.102',\n",
    "    'tel': '020-61787222',\n",
    "    'type': '住宿服务;住宿服务相关;住宿服务相关'},\n",
    "   {'id': 'B0H1YMW8PH',\n",
    "    'direction': '西北',\n",
    "    'businessarea': [],\n",
    "    'address': '温泉镇中山大学南方学院博学路6号西区食堂首层',\n",
    "    'poiweight': '0.214311',\n",
    "    'name': '肯德基(从化南方学院店)',\n",
    "    'location': '113.676031,23.631594',\n",
    "    'distance': '419.018',\n",
    "    'tel': '4009200715',\n",
    "    'type': '餐饮服务;快餐厅;快餐厅'},\n",
    "   {'id': 'B0HGD592BJ',\n",
    "    'direction': '东北',\n",
    "    'businessarea': [],\n",
    "    'address': '温泉大道882号',\n",
    "    'poiweight': '0.221662',\n",
    "    'name': '广州南方学院综合楼',\n",
    "    'location': '113.680109,23.631605',\n",
    "    'distance': '398.334',\n",
    "    'tel': [],\n",
    "    'type': '地名地址信息;门牌信息;楼栋号'},\n",
    "   {'id': 'B0HGD58NF8',\n",
    "    'direction': '北',\n",
    "    'businessarea': [],\n",
    "    'address': '温泉大道882号广州南方学院新综合楼2层',\n",
    "    'poiweight': '0.191229',\n",
    "    'name': '广州南方学院达人书院',\n",
    "    'location': '113.679041,23.632392',\n",
    "    'distance': '446.366',\n",
    "    'tel': [],\n",
    "    'type': '科教文化服务;学校;高等院校'},\n",
    "   {'id': 'B0JBGSFI8C',\n",
    "    'direction': '西北',\n",
    "    'businessarea': [],\n",
    "    'address': '温泉大道882号',\n",
    "    'poiweight': '0.115716',\n",
    "    'name': '广州南方学院西学楼1号楼',\n",
    "    'location': '113.675570,23.630596',\n",
    "    'distance': '365.742',\n",
    "    'tel': [],\n",
    "    'type': '地名地址信息;门牌信息;楼栋号'}]},\n",
    " 'info': 'OK',\n",
    " 'infocode': '10000'}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 153,
   "id": "01a9ff0a",
   "metadata": {},
   "outputs": [
    {
     "ename": "SyntaxError",
     "evalue": "invalid character '？' (U+FF1F) (1292206915.py, line 2)",
     "output_type": "error",
     "traceback": [
      "\u001b[1;36m  Cell \u001b[1;32mIn[153], line 2\u001b[1;36m\u001b[0m\n\u001b[1;33m    keys有哪些？\u001b[0m\n\u001b[1;37m           ^\u001b[0m\n\u001b[1;31mSyntaxError\u001b[0m\u001b[1;31m:\u001b[0m invalid character '？' (U+FF1F)\n"
     ]
    }
   ],
   "source": [
    "#\n",
    "keys有哪些？\n",
    "roads 有哪些？\n",
    "name 有哪些？\n",
    "direction 为 北的 name 有哪些？\n",
    "有 tel 的 建筑（name）有哪些？\n",
    "type 为\"餐饮服务\"有哪些？\n",
    "distance 小于200米的建筑设施有哪些？"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 154,
   "id": "90eb5c43",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "dict_keys(['status', 'regeocode', 'info', 'infocode'])"
      ]
     },
     "execution_count": 154,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "geo_nfu.keys()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 155,
   "id": "9ee69865",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'roads': [{'id': '020F49F0050461206',\n",
       "   'location': '113.678,23.6284',\n",
       "   'direction': '北',\n",
       "   'name': '博学路',\n",
       "   'distance': '7.63232'},\n",
       "  {'id': '020F49F0050462229',\n",
       "   'location': '113.679,23.6245',\n",
       "   'direction': '北',\n",
       "   'name': '老虎形街',\n",
       "   'distance': '445.159'},\n",
       "  {'id': '020F49F005046601453',\n",
       "   'location': '113.677,23.6347',\n",
       "   'direction': '南',\n",
       "   'name': '中山路',\n",
       "   'distance': '712.706'}],\n",
       " 'roadinters': [{'second_name': '中山路',\n",
       "   'first_id': '020F49F0050461206',\n",
       "   'second_id': '020F49F005046601453',\n",
       "   'location': '113.676745,23.634493',\n",
       "   'distance': '691.177',\n",
       "   'first_name': '博学路',\n",
       "   'direction': '南'}],\n",
       " 'formatted_address': '广东省广州市从化区温泉镇博学路广州南方学院',\n",
       " 'addressComponent': {'city': '广州市',\n",
       "  'province': '广东省',\n",
       "  'adcode': '440117',\n",
       "  'district': '从化区',\n",
       "  'towncode': '440117100000',\n",
       "  'streetNumber': {'number': '24号',\n",
       "   'location': '113.677267,23.629149',\n",
       "   'direction': '西北',\n",
       "   'distance': '129.943',\n",
       "   'street': '博学路'},\n",
       "  'country': '中国',\n",
       "  'township': '温泉镇',\n",
       "  'businessAreas': [[]],\n",
       "  'building': {'name': [], 'type': []},\n",
       "  'neighborhood': {'name': [], 'type': []},\n",
       "  'citycode': '020'},\n",
       " 'aois': [{'area': '530435.909488',\n",
       "   'type': '141201',\n",
       "   'id': 'B00140MR9A',\n",
       "   'location': '113.679240,23.632576',\n",
       "   'adcode': '440117',\n",
       "   'name': '广州南方学院',\n",
       "   'distance': '0'}],\n",
       " 'pois': [{'id': 'B00140MR9A',\n",
       "   'direction': '北',\n",
       "   'businessarea': [],\n",
       "   'address': '温泉大道882号',\n",
       "   'poiweight': '0.450402',\n",
       "   'name': '广州南方学院',\n",
       "   'location': '113.679240,23.632576',\n",
       "   'distance': '470.34',\n",
       "   'tel': [],\n",
       "   'type': '科教文化服务;学校;高等院校'},\n",
       "  {'id': 'B0FFK8J7XY',\n",
       "   'direction': '东',\n",
       "   'businessarea': [],\n",
       "   'address': '温泉大道882号广州南方学院',\n",
       "   'poiweight': '0.233244',\n",
       "   'name': '广州南方学院(东南门)',\n",
       "   'location': '113.678689,23.628304',\n",
       "   'distance': '44.279',\n",
       "   'tel': [],\n",
       "   'type': '通行设施;临街院门;临街院门'},\n",
       "  {'id': 'B0FFHRJDM9',\n",
       "   'direction': '东南',\n",
       "   'businessarea': [],\n",
       "   'address': '中大南方学院南门1号',\n",
       "   'poiweight': '0.256152',\n",
       "   'name': '中南公寓',\n",
       "   'location': '113.680340,23.627566',\n",
       "   'distance': '231.223',\n",
       "   'tel': '13711245345',\n",
       "   'type': '商务住宅;住宅区;住宅小区'},\n",
       "  {'id': 'B0H0M9NO43',\n",
       "   'direction': '东北',\n",
       "   'businessarea': [],\n",
       "   'address': '博学路广州南方学院',\n",
       "   'poiweight': '0.292147',\n",
       "   'name': '广州南方学院南方湖观景台',\n",
       "   'location': '113.679464,23.630429',\n",
       "   'distance': '252.022',\n",
       "   'tel': [],\n",
       "   'type': '风景名胜;风景名胜;观景点'},\n",
       "  {'id': 'B0FFHC4XU0',\n",
       "   'direction': '东北',\n",
       "   'businessarea': [],\n",
       "   'address': '温泉大道886号',\n",
       "   'poiweight': '0.191595',\n",
       "   'name': '广州南方学院学术交流中心',\n",
       "   'location': '113.680066,23.630242',\n",
       "   'distance': '270.76',\n",
       "   'tel': [],\n",
       "   'type': '科教文化服务;会展中心;会展中心'},\n",
       "  {'id': 'B0FFKP838K',\n",
       "   'direction': '北',\n",
       "   'businessarea': [],\n",
       "   'address': '博学路25号',\n",
       "   'poiweight': '0.191742',\n",
       "   'name': '教学楼3号(外国语学院)',\n",
       "   'location': '113.677247,23.630947',\n",
       "   'distance': '298.093',\n",
       "   'tel': [],\n",
       "   'type': '科教文化服务;学校;高等院校'},\n",
       "  {'id': 'B0FFG4TAF2',\n",
       "   'direction': '东南',\n",
       "   'businessarea': [],\n",
       "   'address': '温泉镇乌土村松浪队5号(近博学路)',\n",
       "   'poiweight': '0.237309',\n",
       "   'name': '广州南方公寓',\n",
       "   'location': '113.678983,23.627778',\n",
       "   'distance': '102.617',\n",
       "   'tel': '13622768437',\n",
       "   'type': '住宿服务;旅馆招待所;旅馆招待所'},\n",
       "  {'id': 'B0FFKP7GY5',\n",
       "   'direction': '北',\n",
       "   'businessarea': [],\n",
       "   'address': '温泉大道882号',\n",
       "   'poiweight': '0.218221',\n",
       "   'name': '广州南方学院3号实验楼',\n",
       "   'location': '113.678650,23.630612',\n",
       "   'distance': '244.566',\n",
       "   'tel': [],\n",
       "   'type': '地名地址信息;门牌信息;楼栋号'},\n",
       "  {'id': 'B0GKYRKNUA',\n",
       "   'direction': '东南',\n",
       "   'businessarea': [],\n",
       "   'address': '温泉镇平岗村乌土平岗街25号(中南公寓旁)',\n",
       "   'poiweight': '0.209893',\n",
       "   'name': '乐妍茶(中大店)',\n",
       "   'location': '113.680097,23.627643',\n",
       "   'distance': '205.173',\n",
       "   'tel': '18028862548',\n",
       "   'type': '餐饮服务;冷饮店;冷饮店'},\n",
       "  {'id': 'B0H33OZ7BU',\n",
       "   'direction': '北',\n",
       "   'businessarea': [],\n",
       "   'address': '博学路广州南方学院',\n",
       "   'poiweight': '0.191148',\n",
       "   'name': '广州南方学院学术报告厅',\n",
       "   'location': '113.678698,23.631219',\n",
       "   'distance': '312.056',\n",
       "   'tel': [],\n",
       "   'type': '科教文化服务;科教文化场所;科教文化场所'},\n",
       "  {'id': 'B0JRKNVEFY',\n",
       "   'direction': '东北',\n",
       "   'businessarea': [],\n",
       "   'address': '温泉镇笃行路20、22、24号广州南方学院商业中心1层1F-001-1号',\n",
       "   'poiweight': '0.209894',\n",
       "   'name': '喜茶(广州南方学院店)',\n",
       "   'location': '113.679905,23.630533',\n",
       "   'distance': '285.72',\n",
       "   'tel': [],\n",
       "   'type': '餐饮服务;冷饮店;冷饮店'},\n",
       "  {'id': 'B0HGD588HJ',\n",
       "   'direction': '北',\n",
       "   'businessarea': [],\n",
       "   'address': '温泉大道882号',\n",
       "   'poiweight': '0.221662',\n",
       "   'name': '广州南方学院4号教学楼',\n",
       "   'location': '113.677461,23.630578',\n",
       "   'distance': '252.08',\n",
       "   'tel': [],\n",
       "   'type': '地名地址信息;门牌信息;楼栋号'},\n",
       "  {'id': 'B0H1XKYTYG',\n",
       "   'direction': '西北',\n",
       "   'businessarea': [],\n",
       "   'address': '温泉大道882号广州南方学院',\n",
       "   'poiweight': '0.198742',\n",
       "   'name': '广州南方学院西区篮球场',\n",
       "   'location': '113.677741,23.629552',\n",
       "   'distance': '135.401',\n",
       "   'tel': [],\n",
       "   'type': '体育休闲服务;运动场馆;篮球场馆'},\n",
       "  {'id': 'B0HGDU76L2',\n",
       "   'direction': '北',\n",
       "   'businessarea': [],\n",
       "   'address': '温泉大道882号',\n",
       "   'poiweight': '0.221662',\n",
       "   'name': '广州南方学院2号实验楼',\n",
       "   'location': '113.678327,23.630969',\n",
       "   'distance': '281.377',\n",
       "   'tel': [],\n",
       "   'type': '地名地址信息;门牌信息;楼栋号'},\n",
       "  {'id': 'B0IB2GMPW4',\n",
       "   'direction': '东北',\n",
       "   'businessarea': [],\n",
       "   'address': '温泉镇笃行路20、22、24号中山大学南方学院商业中心一楼1F-005',\n",
       "   'poiweight': '0.218331',\n",
       "   'name': '古茗(南方学院店)',\n",
       "   'location': '113.680105,23.630681',\n",
       "   'distance': '311.024',\n",
       "   'tel': '13717659301;18027267535',\n",
       "   'type': '餐饮服务;休闲餐饮场所;休闲餐饮场所'},\n",
       "  {'id': 'B0I12780ZU',\n",
       "   'direction': '东南',\n",
       "   'businessarea': [],\n",
       "   'address': '内部地面停车场',\n",
       "   'poiweight': '0.203102',\n",
       "   'name': '内部地面停车场(出入口)',\n",
       "   'location': '113.679445,23.627444',\n",
       "   'distance': '162.262',\n",
       "   'tel': [],\n",
       "   'type': '交通设施服务;停车场;停车场出入口'},\n",
       "  {'id': 'B0I1276BCM',\n",
       "   'direction': '东南',\n",
       "   'businessarea': [],\n",
       "   'address': [],\n",
       "   'poiweight': '0.257239',\n",
       "   'name': '内部地面停车场',\n",
       "   'location': '113.679445,23.627444',\n",
       "   'distance': '162.262',\n",
       "   'tel': [],\n",
       "   'type': '交通设施服务;停车场;专用停车场'},\n",
       "  {'id': 'B0H25SMRKP',\n",
       "   'direction': '东北',\n",
       "   'businessarea': [],\n",
       "   'address': '温泉大道882号广州南方学院',\n",
       "   'poiweight': '0.263595',\n",
       "   'name': '广州南方学院大礼堂',\n",
       "   'location': '113.680076,23.631502',\n",
       "   'distance': '386.65',\n",
       "   'tel': [],\n",
       "   'type': '科教文化服务;科教文化场所;科教文化场所'},\n",
       "  {'id': 'BV11417822',\n",
       "   'direction': '东南',\n",
       "   'businessarea': [],\n",
       "   'address': '从15路从20路',\n",
       "   'poiweight': '0.400088',\n",
       "   'name': '南方学院后门总站(公交站)',\n",
       "   'location': '113.679280,23.627201',\n",
       "   'distance': '171.243',\n",
       "   'tel': [],\n",
       "   'type': '交通设施服务;公交车站;公交车站相关'},\n",
       "  {'id': 'B0FFK0MZII',\n",
       "   'direction': '东',\n",
       "   'businessarea': [],\n",
       "   'address': '温泉大道882号广州南方学院后门润泰超市一楼',\n",
       "   'poiweight': '0.10175',\n",
       "   'name': '街电(尚千谷中大南方店)',\n",
       "   'location': '113.680254,23.627804',\n",
       "   'distance': '213.132',\n",
       "   'tel': [],\n",
       "   'type': '生活服务;共享设备;充电宝'},\n",
       "  {'id': 'B0HRV1D5FP',\n",
       "   'direction': '东北',\n",
       "   'businessarea': [],\n",
       "   'address': '温泉大道882号广州南方学院',\n",
       "   'poiweight': '0.191158',\n",
       "   'name': '广州南方学院博物馆',\n",
       "   'location': '113.679624,23.631631',\n",
       "   'distance': '380.463',\n",
       "   'tel': [],\n",
       "   'type': '科教文化服务;博物馆;博物馆'},\n",
       "  {'id': 'B0FFKMSV6B',\n",
       "   'direction': '西北',\n",
       "   'businessarea': [],\n",
       "   'address': '温泉大道882号',\n",
       "   'poiweight': '0.232574',\n",
       "   'name': '广州南方学院西学楼2号楼',\n",
       "   'location': '113.675891,23.630025',\n",
       "   'distance': '300.564',\n",
       "   'tel': [],\n",
       "   'type': '地名地址信息;门牌信息;楼栋号'},\n",
       "  {'id': 'B0FFKP81F0',\n",
       "   'direction': '西北',\n",
       "   'businessarea': [],\n",
       "   'address': '博学路与中山路交叉口南340米',\n",
       "   'poiweight': '0.191742',\n",
       "   'name': '教学楼1号(文学与传媒学院)',\n",
       "   'location': '113.676866,23.631736',\n",
       "   'distance': '393.93',\n",
       "   'tel': [],\n",
       "   'type': '科教文化服务;科教文化场所;科教文化场所'},\n",
       "  {'id': 'B0HGDU99RM',\n",
       "   'direction': '北',\n",
       "   'businessarea': [],\n",
       "   'address': '温泉大道882号广州南方学院内',\n",
       "   'poiweight': '0.257947',\n",
       "   'name': '广州南方学院图书馆',\n",
       "   'location': '113.679303,23.632322',\n",
       "   'distance': '444.196',\n",
       "   'tel': '020-61787368;020-61787371',\n",
       "   'type': '科教文化服务;图书馆;图书馆'},\n",
       "  {'id': 'B0HGDU92JD',\n",
       "   'direction': '北',\n",
       "   'businessarea': [],\n",
       "   'address': '温泉大道882号',\n",
       "   'poiweight': '0.221662',\n",
       "   'name': '广州南方学院1号教学楼',\n",
       "   'location': '113.676968,23.631720',\n",
       "   'distance': '388.57',\n",
       "   'tel': [],\n",
       "   'type': '地名地址信息;门牌信息;楼栋号'},\n",
       "  {'id': 'B0FFH6K3U9',\n",
       "   'direction': '西北',\n",
       "   'businessarea': [],\n",
       "   'address': '温泉镇温泉大道882号广州南方学院H7栋1-5层',\n",
       "   'poiweight': '0.254885',\n",
       "   'name': '广州中大南方招待所',\n",
       "   'location': '113.676330,23.631332',\n",
       "   'distance': '378.102',\n",
       "   'tel': '020-61787222',\n",
       "   'type': '住宿服务;住宿服务相关;住宿服务相关'},\n",
       "  {'id': 'B0H1YMW8PH',\n",
       "   'direction': '西北',\n",
       "   'businessarea': [],\n",
       "   'address': '温泉镇中山大学南方学院博学路6号西区食堂首层',\n",
       "   'poiweight': '0.214311',\n",
       "   'name': '肯德基(从化南方学院店)',\n",
       "   'location': '113.676031,23.631594',\n",
       "   'distance': '419.018',\n",
       "   'tel': '4009200715',\n",
       "   'type': '餐饮服务;快餐厅;快餐厅'},\n",
       "  {'id': 'B0HGD592BJ',\n",
       "   'direction': '东北',\n",
       "   'businessarea': [],\n",
       "   'address': '温泉大道882号',\n",
       "   'poiweight': '0.221662',\n",
       "   'name': '广州南方学院综合楼',\n",
       "   'location': '113.680109,23.631605',\n",
       "   'distance': '398.334',\n",
       "   'tel': [],\n",
       "   'type': '地名地址信息;门牌信息;楼栋号'},\n",
       "  {'id': 'B0HGD58NF8',\n",
       "   'direction': '北',\n",
       "   'businessarea': [],\n",
       "   'address': '温泉大道882号广州南方学院新综合楼2层',\n",
       "   'poiweight': '0.191229',\n",
       "   'name': '广州南方学院达人书院',\n",
       "   'location': '113.679041,23.632392',\n",
       "   'distance': '446.366',\n",
       "   'tel': [],\n",
       "   'type': '科教文化服务;学校;高等院校'},\n",
       "  {'id': 'B0JBGSFI8C',\n",
       "   'direction': '西北',\n",
       "   'businessarea': [],\n",
       "   'address': '温泉大道882号',\n",
       "   'poiweight': '0.115716',\n",
       "   'name': '广州南方学院西学楼1号楼',\n",
       "   'location': '113.675570,23.630596',\n",
       "   'distance': '365.742',\n",
       "   'tel': [],\n",
       "   'type': '地名地址信息;门牌信息;楼栋号'}]}"
      ]
     },
     "execution_count": 155,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "geo_nfu[\"regeocode\"]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 161,
   "id": "35513832",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "dict_keys(['roads', 'roadinters', 'formatted_address', 'addressComponent', 'aois', 'pois'])"
      ]
     },
     "execution_count": 161,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "geo_nfu[\"regeocode\"].keys()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 172,
   "id": "fb8a3977",
   "metadata": {},
   "outputs": [],
   "source": [
    "regeocode_data = list(geo_nfu[\"regeocode\"].keys())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 173,
   "id": "81dcf7ab",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['roads',\n",
       " 'roadinters',\n",
       " 'formatted_address',\n",
       " 'addressComponent',\n",
       " 'aois',\n",
       " 'pois']"
      ]
     },
     "execution_count": 173,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "regeocode_data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 174,
   "id": "0c512d14",
   "metadata": {},
   "outputs": [
    {
     "ename": "TypeError",
     "evalue": "list indices must be integers or slices, not str",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mTypeError\u001b[0m                                 Traceback (most recent call last)",
      "Cell \u001b[1;32mIn[174], line 1\u001b[0m\n\u001b[1;32m----> 1\u001b[0m regeocode_data[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mroads\u001b[39m\u001b[38;5;124m'\u001b[39m]\n",
      "\u001b[1;31mTypeError\u001b[0m: list indices must be integers or slices, not str"
     ]
    }
   ],
   "source": [
    "regeocode_data['roads']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 110,
   "id": "d389ebbc",
   "metadata": {},
   "outputs": [
    {
     "ename": "TypeError",
     "evalue": "'dict_keys' object is not subscriptable",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mTypeError\u001b[0m                                 Traceback (most recent call last)",
      "Cell \u001b[1;32mIn[110], line 2\u001b[0m\n\u001b[0;32m      1\u001b[0m name \u001b[38;5;241m=\u001b[39m []\n\u001b[1;32m----> 2\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m i \u001b[38;5;129;01min\u001b[39;00m regeocode_data[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mpois\u001b[39m\u001b[38;5;124m\"\u001b[39m]:\n\u001b[0;32m      3\u001b[0m     name\u001b[38;5;241m.\u001b[39mappend(i[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mname\u001b[39m\u001b[38;5;124m\"\u001b[39m])\n",
      "\u001b[1;31mTypeError\u001b[0m: 'dict_keys' object is not subscriptable"
     ]
    }
   ],
   "source": [
    "name = []\n",
    "for i in regeocode_data[\"pois\"]:\n",
    "    name.append(i[\"name\"])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 114,
   "id": "bec7b7cd",
   "metadata": {},
   "outputs": [
    {
     "ename": "NameError",
     "evalue": "name 'roads' is not defined",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mNameError\u001b[0m                                 Traceback (most recent call last)",
      "Cell \u001b[1;32mIn[114], line 1\u001b[0m\n\u001b[1;32m----> 1\u001b[0m roads\u001b[38;5;241m.\u001b[39mvalues()\n",
      "\u001b[1;31mNameError\u001b[0m: name 'roads' is not defined"
     ]
    }
   ],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "2f7350c8",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
